package com.swq.java.code.chapter06.code02;

class Base {
    private String showMe() {
        return "Base";
    }

    public void print() {
        System.out.println(showMe());  //到底调用Base类的showMe()还是Sub类的showMe()?
    }

    void testOverride() {
        System.out.println("test override");
    }
}

public abstract class Sub extends Base {
    public String showMe() {
        return "Sub";
    }

    public static void main(String args[]) {
        Sub sub = new Sub() {
            @Override
            public void testOverride() {
                System.out.println("test override sub");
            }
        };
        sub.print();
        sub.testOverride();
    }

    public abstract void testOverride();
}